package com_djm_2025_06_04;

/**
 * 用于演示构造方法的示例类，利用构造方法优化过后的
 *
 * @author dengjiangming
 * @version 1.0.0
 * @date 2025-06-04
 */
public class Constructor {

    public String name;

    public int age;

    public String className;

    public String favoriteBook;

    public String favoriteSport;

    @Override
    public String toString() {
        return "Constructor{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", className='" + className + '\'' +
                ", favoriteBook='" + favoriteBook + '\'' +
                ", favoriteSport='" + favoriteSport + '\'' +
                '}';
    }

    public Constructor() {
    }

    public Constructor(String name, int age, String className, String favoriteBook, String favoriteSport) {
        this.name = name;
        this.age = age;
        this.className = className;
        this.favoriteBook = favoriteBook;
        this.favoriteSport = favoriteSport;
    }

    public static void main(String[] args) {
        Constructor constructor = new Constructor("dengjiangming",22,"Java","哈里波特","跑步");
        System.out.println(constructor);
    }
}
